<template>
<div class="allBody">
<div class="headBody">
  <div class="title">待办事项</div>
</div>
<div class="underBody1">
  <input type="text" placeholder="请输入有效内容，回车进行添加" v-model="witeText" @change.keyup.enter="witeTextAdd">
</div>
<div class="underBody2">
  <ul>
    <li v-for="(item, index) in txtArr" :key="index">
      <div class="underBody2_head">
        <input type="checkbox" v-model="item.status">
        <span>{{ item.content }}</span>
      </div>
     <div class="underBody2_last">
      <input type="button" value="删除" class="textDel">
    </div>
    </li>
  </ul>
</div>
<div class="leafBody">
  <div class="zongji">总计：{{txtArr.length}}</div>
  <div class="buttons">
    <input type="button" class="underBtn" value="全部">
    <input type="button" class="underBtn" value="未完成">
    <input type="button" class="underBtn" value="已完成">
  </div>
</div>
</div>
</template>


<script setup>
import { ref,computed } from 'vue';


let witeText=ref('')
let isArr= computed(()=>{
let tep = witeText.value.trim();
return tep.length<=25|| tep.length>0
})
let txtArr = ref([
  {
    content:'这是一封离别信',
    status:false
  },
  {
    content:"写下我该离开的消息",
    status:false
  }
])
function witeTextAdd(){
  console.log(witeText);
  
  if(isArr){
    return
  }
  let tepObj={
    content:witeText.value,
    status:false
  }
  txtArr.value.push(tepObj);
  witeText.value=''
}

</script>



<style>
*{
  margin: 0px;
  padding: 0px;
}
body{
  display: flex;
  background-color: rgb(210, 219, 194);
}
#app{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.allBody{
  display: flex;
  height: 800px;
  width: 1000px;
  flex-direction: column;
}
.headBody{
  display: flex;
  height: 100px;
  width: 1000px;
  justify-content: center;
  align-items: center;
}
.underBody1{

  display: inline-block;
}
.underBody2{
  background-color: white;
  height: 580px;
  width: 1000px;
  border-radius: 5px;
  margin-top: 10px
}
.leafBody{
  display: flex;
  height: 50px;
  width: 1000px;
  justify-content: space-between;
  margin-top: 10px;
  background-color: white;
  border-radius: 5px;
  
}
.title{
  display: inline-block;
  display: flex;
  font-size: 40px;
  font-weight: 900;
}
.underBody1 input{
  height: 50px;
  width: 1000px;
  border: 0px;
  border-radius: 5px;
  text-indent: 30px;
  font-size: 15px;
  }
.zongji{
  display: flex;
   width: 300px;
  height: 50px;
  font-size: 17px;
  line-height: 50px;
  margin-left: 10px;
}
.buttons{
  display: flex;
  width: 135px;
  height: 50px;
 
}
.buttons input{
  margin-left: 5px;
  border: 0px;
  background-color: white;
}
.underBody2 ul{
  list-style: none;
}
.underBody2 li{
display: flex;
  height: 45px;
  font-size:17px;
  background-color:rgb(204, 255, 204);
  border-radius: 5px;
  line-height: 45px;margin-top: 3px;
  margin-left: 3px;
  margin-right: 3px;
  align-items: center;
  justify-content: space-between;
  
}
.textDel{
  margin-right: 10px;
  border: 0px;
  border: 0px;
  background-color: rgb(204, 255, 204);
  display: none;
}
.underBody2 li:hover .textDel{
  display: inline;
}
.textDel:hover,.underBtn:hover{
  color: blue;
  text-decoration: underline;
}
.textDel:active,.underBtn:active{
  color: red;
}
.underBody2_head{
  margin-left: 5px;
}
.underBody2_head span{
  margin-left: 5px;
}



  
</style>